﻿local PMEngine, L, PrivateDB, ProfileDB, GlobalDB = unpack(select(2, ...)); 
local AL = PMEngine:NewModule('AutoCombatlog', 'AceEvent-3.0')

function AL:PLAYER_LOGOUT()
	LoggingCombat(0)
end

function AL:PLAYER_ENTERING_WORLD()
    if not PMEngine.db.general.autoCombatlog then return false end
	LoggingCombat(1)
	PMEngine:Print("Combatlog automatically enabled.")
end

function AL:Initialize()
	if not PMEngine.db.general.autoCombatlog then return false end
	
	self:RegisterEvent("PLAYER_ENTERING_WORLD")
	self:RegisterEvent("PLAYER_LOGOUT")
end

PMEngine:RegisterModule(AL:GetName())